package com.team.app.service;

import java.util.Date;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.team.app.dao.VehicleDao;
import com.team.app.model.Vehicle;
import com.team.app.model.VehicleView;


@Service
public class VehicleServiceImpl implements VehicleService{
	@Autowired
    private VehicleDao vehicleDao;     

	@Override
	@Transactional
	public Long create(Vehicle obj) {
		// TODO Auto-generated method stub
		return vehicleDao.create(obj);
	}

	@Override
	@Transactional
	public void edit(Vehicle obj) {
		// TODO Auto-generated method stub
		vehicleDao.edit(obj);
	}

	@Override
	@Transactional
	public void remove(Vehicle obj) {
		// TODO Auto-generated method stub
		vehicleDao.remove(obj);
	}

	@Override
	@Transactional
	public Vehicle find(Object id) {
		// TODO Auto-generated method stub
		return vehicleDao.find(id);
	}

	@Override
	@Transactional
	public List<Vehicle> findAll() {
		// TODO Auto-generated method stub
		return vehicleDao.findAll();
	}

	@Override
	@Transactional
	public List<Vehicle> findRange(int[] range) {
		// TODO Auto-generated method stub
		return vehicleDao.findRange(range);
	}

	@Override
	@Transactional
	public Long count() {
		// TODO Auto-generated method stub
		return vehicleDao.count();
	} 
	
	@Override
	@Transactional
	public List<Vehicle> findVehicle(Long modelId) {
		// TODO Auto-generated method stub
		return vehicleDao.findVehicle(modelId);
	}


	@Override
	@Transactional
	public List<VehicleView> findAllView() {
		// TODO Auto-generated method stub
		return vehicleDao.findAllView();
	}

	@Override
	@Transactional
	public List<VehicleView> findTopCar() {
		// TODO Auto-generated method stub
		return vehicleDao.findTopCar();
	}

	@Override
	@Transactional
	public List<VehicleView> findCar(Date pickupDate, Date returnDate,
			Long cityID, String numberSeat, Long brandID, Long transmissionType) {
		// TODO Auto-generated method stub
		return vehicleDao.findCar(pickupDate, returnDate, cityID, numberSeat, brandID, transmissionType);
	}

}
